﻿@using BXJG.Utils.Application.Share.GeneralTree
@using Microsoft.AspNetCore.Components.Sections
@using ZLJ.Application.Share.Administrative

@inherits TreeDetailUpdateBaseComponent<AdministrativeDto, AdministrativeEditDto>
<SectionContent SectionName=@(FuncName+"-detail-update-title")>
    <Icon Type=@detailUpdateIcon Theme=@IconThemeType.Outline />
    @(detailUpdateText)@(FuncName)
</SectionContent>
<SectionContent SectionName=@(FuncName + "-detail-update-body")>

    @if (isEdit)
    {
        <Form @ref="frm" ValidateOnChange="true" Model="editDto" LabelColSpan="4" WrapperColSpan="20" OnFinish="OnFinish">

            <Descriptions Bordered Size="small">
                <DescriptionsItem Title="父级">
                    <AdministrativeTreeSelect @bind-Value="@context.ParentIdString" IsKeyId AllowClear Style="width:15rem;" />
                </DescriptionsItem>
                <DescriptionsItem Title="名称">
                    <Input @bind-Value="@context.DisplayName" />
                </DescriptionsItem>
            </Descriptions>

        </Form>
    }
    else
    {
        <Descriptions Bordered Size="small">
            <DescriptionsItem Title="父级">
                @dto.ParentDisplayName
            </DescriptionsItem>
            <DescriptionsItem Title="名称">
                @dto.DisplayName
            </DescriptionsItem>
        </Descriptions>
    }
</SectionContent>
<SectionContent SectionName=@(FuncName + "-detail-update-btns")>
    @if (IsShowDelete)
    {
        <Popconfirm Title="确定删除此项吗?" OnConfirm=@BtnDeleteClick>
            <Button Loading=isDeleting Danger=true>删除</Button>
        </Popconfirm>
    }
    <ButtonGroup>
        @if (IsShowRefresh)
        {
            <Button OnClick="BtnRefreshClick" Loading=isRefreshing Disabled=IsBusy>刷新</Button>
        }
        @if (IsShowBeginEdit)
        {
            <Button OnClick="BtnBeginEditClick" Loading=isFormIniting Type="@ButtonType.Primary">修改</Button>
        }
        else if (IsShowUpdate)
        {
            <Button OnClick="BtnResetClick" Loading=isReseting Disabled=IsBusy Icon="@IconType.Outline.Redo">重置</Button>
            <Button OnClick="BtnCancelEditClick" Disabled=IsBusy Icon="@IconType.Outline.Rollback">放弃修改</Button>
            <Button OnClick="BtnUpdateClick" Type="@ButtonType.Primary" Loading="@isUpdating" Disabled="@IsBusy" Icon="@IconType.Outline.Save">保存</Button>
        }
    </ButtonGroup>
</SectionContent>